package ca.mcgill.mni.bic;

import java.sql.Date;

public class StudyListing {
	public Integer tarchiveID;
	public String patientName;
	public String patientID;
	public Date dateAcquired, dateSent;
	public String studyUID;
	public int numSeries;
	public Boolean pendingTransfer;
	
	public StudyListing(Integer tarchiveID, String studyUID, String patientName, String patientID, Date dateAcquired, int numSeries, Date dateSent, Boolean pendingTransfer) {
		this.tarchiveID = tarchiveID;
		this.studyUID = studyUID;
		this.patientName = patientName;
		this.patientID = patientID;
		this.dateAcquired = dateAcquired;
		this.numSeries = numSeries;
		this.dateSent = dateSent;
		this.pendingTransfer = pendingTransfer;
	}
	
	public Study getStudy() {
		Study study = QcTool.tarDb.studyFactory(tarchiveID);
		return study;
	}
	
	public String getLabel() {
		return patientName + " " + dateAcquired;
	}
	
	public boolean wasSent() {
		return (dateSent != null);
	}
	
	public boolean pendingTransfer() {
		return pendingTransfer;
	}
	
	@Override
	public String toString() {
		String s = "" + tarchiveID + "\t" + studyUID + "\t" + patientName + "\t" + patientID + "\t" + dateAcquired;
		return s;
	}
}
